home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group94a.txt / 000176_icon-group-sender _Thu Jun 16 10:17:20 1994.msg < prev    next >
Internet Message Format  |  1994-08-19  |  1KB

  1. Received: by cheltenham.cs.arizona.edu; Thu, 16 Jun 1994 12:22:34 MST
  2. Date: Thu, 16 Jun 1994 10:17:20 +0700
  3. From: swampler@noao.edu
  4. Message-Id: <9406161717.AA18280@orpheus.gemini.edu>
  5. Subject: Re: Another Spin
  6. To: Mark.Otto@census.gov
  7. Cc: icon-group@cs.arizona.edu
  8. Content-Length: 767
  9. Status: R
  10. Errors-To: icon-group-errors@cs.arizona.edu
  11.  
  12.  
  13. >>Not to take the fun out of writing coexpressions,
  14. >>but here is a simpler version of spin I got to
  15. >>work on a SUN4.  Use ^c to stop the program.
  16. >>
  17. >>procedure main()
  18. >> writes(" ")
  19. >> every writes(!|["\b-","\b\\","\b|","\b/"])
  20. >>end
  21. >>
  22.  
  23. How about:
  24.  
  25.    procedure main()
  26.       every writes(|!"-\b\\=b|\b/\b")
  27.    end
  28.  
  29. but to neatly 'spin' any sequence:
  30.  
  31.    procedure main(args)
  32.       spin_word := args[1] | "-\\|/"
  33.  
  34.       every writes( weave (spin_word, "\b") )
  35.    end
  36.  
  37.    procedure weave(s1,s2)
  38.       e1 := create |!s1        # infinite loop of chars from s1
  39.       e2 := create |!s2        # infinite loop of chars from s2
  40.       suspend @!(e1 | e2)    # this expression interleaves result sequences
  41.    end
  42.  
  43.       
  44. --
  45. Steve Wampler
  46. swampler@gemini.edu
  47. Gemini Project (under AURA)
  48.